export interface Song {
  id: string;
  title: string;
  artist: string;
  cover: string;
  url: string;
}

export interface Banner {
  id: string;
  image: string;
  link?: string;
}

const songs: Song[] = [
  {
    id: '1',
    title: 'Summer Vibes',
    artist: 'Kevin MacLeod',
    cover: 'https://picsum.photos/id/1/300/300',
    url: 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3'
  },
  {
    id: '2',
    title: 'Jazz in Paris',
    artist: 'Media Right Productions',
    cover: 'https://picsum.photos/id/10/300/300',
    url: 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-2.mp3'
  },
  {
    id: '3',
    title: 'Acoustic Breeze',
    artist: 'Benjamin Tissot',
    cover: 'https://picsum.photos/id/100/300/300',
    url: 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-3.mp3'
  },
  {
    id: '4',
    title: 'Happy Rock',
    artist: 'Kevin MacLeod',
    cover: 'https://picsum.photos/id/1000/300/300',
    url: 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-4.mp3'
  },
  {
    id: '5',
    title: 'Ukulele',
    artist: 'Benjamin Tissot',
    cover: 'https://picsum.photos/id/1001/300/300',
    url: 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-5.mp3'
  },
  {
    id: '6',
    title: 'Memories',
    artist: 'Bensound',
    cover: 'https://picsum.photos/id/1002/300/300',
    url: 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-6.mp3'
  }
];

const banners: Banner[] = [
  { 
    id: 'b1', 
    image: 'https://picsum.photos/id/1015/800/320',
    link: '/pages/player/index?id=1'
  },
  { 
    id: 'b2', 
    image: 'https://picsum.photos/id/1016/800/320',
    link: '/pages/player/index?id=2'
  },
  { 
    id: 'b3', 
    image: 'https://picsum.photos/id/1018/800/320',
    link: '/pages/player/index?id=3'
  },
  { 
    id: 'b4', 
    image: 'https://picsum.photos/id/1019/800/320',
    link: '/pages/player/index?id=4'
  },
  { 
    id: 'b5', 
    image: 'https://picsum.photos/id/1020/800/320',
    link: '/pages/player/index?id=5'
  }
];

export const fetchHotSongs = async (): Promise<Song[]> => {
  return songs;
}

export const fetchBanners = async (): Promise<Banner[]> => {
  return banners;
}

export const searchSongs = async (keyword: string): Promise<Song[]> => {
  const k = keyword.trim().toLowerCase();
  if (!k) return [];
  return songs.filter(s => s.title.toLowerCase().includes(k) || s.artist.toLowerCase().includes(k));
}

export const getSongById = (id: string): Song | undefined => songs.find(s => s.id === id);

export const getAllSongs = (): Song[] => songs;